package rmiserver.ui.model;

import java.util.Date;

import rmi.common.ui.model.AbstractModel;
import rmiserver.ui.controller.DefaultController;

public class ConnectionModel extends AbstractModel {
	private ConnectionBean connection;

	public ConnectionBean getConnection() {
		return this.connection;
	}
	
	public void setConnection(String conn_) {
		ConnectionBean oldValue = this.connection;
		String timeStamp = new Date().toString();
		this.connection = new ConnectionBean(conn_, timeStamp);
		System.out.println("Set connection is invoked with " + conn_);
		firePropertyChange(DefaultController.ELEMENT_LIST_USER, oldValue, this.connection);
	}
	
	public void setLoggedAccount(ConnectionBean loggedAccount)
	{
		ConnectionBean oldValue = this.connection;
		this.connection = loggedAccount;
		firePropertyChange(DefaultController.ELEMENT_LOGGED_USER, oldValue, loggedAccount);
	}
	
}
